package com.wjw.dao;

import java.util.List;

import org.apache.ibatis.annotations.Select;

import com.wjw.bean.Permission;
import com.wjw.bean.User;

public interface PermissionDao {
	
	@Select("select * from t_permission where pid is null")
	public Permission findRootPermission();
	
	@Select("select * from t_permission where pid=#{pid}")
	public List<Permission> findChildPermission(Integer pid);
	
	@Select("select * from t_permission")
	public List<Permission> findAll();
	
	public void insertPermission(Permission permission);
	
	@Select("select * from t_permission where id=#{id}")
	public Permission findPerById(Integer id);
	
	public void updatePermission(Permission permission);
	
	public void delPermission(Integer id);
	
	public List<Permission> findPerByUser(User user);
	
	@Select("select permissionid from t_role_permission where roleid=#{id}")
	public List<Integer> findPerByRole(Integer id);
}
